function - haskell equivalent for loop with if statements

HI noob question here but im learning HaskellI'm trying to understand how to iterate 0 through until n and return false if the iteration contains 5 other wise return truehere is my method Fivecount :: Integral a => a -> Bool isfivecount z = Falsewant something like this in JAVAmethod boolean (n){for(int i = 2; i < n; i++){ if(i == 5){ return true; } else{ return false; }}Thanks in advance FRIENDS :) an explanation would be cool too, just really trying to understand Haskell....Read more

How do I declare a function that accepts anything that can be turned into HashMap<String,String>

I have a struct that looks like this:struct Fields { map: HashMap<String, String>}For ergonomics, I want a function that accepts both &str and String. I read that HashMap has a trait FromIterator<(K, V)>, so at an abstract level I could work from anything that produces an iterator of pairs that turns into strings. Analogously, if I want a function that accepts anything that can be turned into a String, I can use the bound T: Into<String>.Can the same be done for an iterator of pairs that can be turned into strings? Conc...Read more

python 3.x - Python3 Creating basic functions - Remove specific character strings/translating

I am playing around with python3 in idle and after discovering what Pig Latin is I am trying to write a couple functions and am confused about where to start/what python specific words/functions I should be using.(i) 1 parameter -I am trying to translate words from pig latin back to English. It would always end with "ay" and only have one hyphen. Essentially I am trying to remove the hypen and "ay" at the end of the pig latin word. I believe I need to start by finding the position of the hyphen. Then I want it to extract from the string 2 subst...Read more

function - What is the equivalent of "!=" in Excel VBA?

The problem is that != does not work as a function in excel vba.I want to be able to use If strTest != "" Then instead of If strTest = "" ThenIs there another approach to do this besides !=?My function to mimic != is Sub test()Dim intTest As IntegerDim strTest As StringintTest = 5strTest = CStr(intTest) ' convertRange("A" + strTest) = "5" For i = 1 To 10 Cells(i, 1) = i If strTest = "" Then Cells(i, 1) = i End If Next iEnd Sub...Read more

Clojure, can macros do something that couldn't be done with a function

I'm learning Clojure macros, and wonder why we can't use just functions for metaprogramming.As far as I know the difference between macro and function is that arguments of macro are not evaluated but passed as data structures and symbols as they are, whereas the return value is evaluated (in the place where macro is called). Macro works as a proxy between reader and evaluator, transforming the form in an arbitrary way before the evaluation takes place. Internally they may use all the language features, including functions, special forms, litera...Read more

function - Haskell Writing Class Basics

I've been running into this problem constantly I'm trying to learn Haskell and right now learning classes. I'm trying to make a function where you enter in three numbers and if they equal each other then returns a True Bool else returns a False Bool.I understand I need a class like this: allTheSame :: a -> a -> a -> BoolHowever I'm constantly get confused what I should put in the function itself after writingallTheSame x y z = I've had this problem before with a function I wrote about showing the minimum value of a 3 variable function....Read more

Table name as a PostgreSQL function parameter

I want to pass a table name as a parameter in a Postgres function. I tried this code:CREATE OR REPLACE FUNCTION some_f(param character varying) RETURNS integer AS $$ BEGIN IF EXISTS (select * from quote_ident($1) where quote_ident($1).id=1) THEN return 1; END IF; return 0; END;$$ LANGUAGE plpgsql;select some_f('table_name');And I got this:ERROR: syntax error at or near "."LINE 4: ...elect * from quote_ident($1) where quote_ident($1).id=1)... ^********** Error ******...Read more

How this canvas function input is incrementing from undefined?

I came across this canvas rotation on Code Pen. The input variable step received no value, but as soon as requestAnimationFrame starts to run, step leaves the state of undefined and modify angle that should be NaN, how this happened?Canvas Rotation - Code Penvar canvas = document.getElementById('canvas');var canvasWidth = canvas.width; var canvasHeight = canvas.height; var cx = canvasWidth/2;var cy = canvasHeight/2;var context = canvas.getContext("2d");function draw(step){ requestAnimationFrame(draw); context.fillStyle = "deepskyblue"; con...Read more

Calling Powershell function from another power shell script works with error prompt

Hi all I have the following script that calls another script which sends an email.The first script is :#check status of schedulerfunction Check_Scheduler{param([int]$filename) if($filename -eq 33){ $Scheduler="Process_F33"}elseif($filename -eq 07){ $Scheduler="Process_F07" }$status=(Get-ScheduledTask | Where TaskName -EQ $Scheduler).State #read from a text file$startTime=(Get-Content -Path E:\AshimTest\time.txt) $endTime = Get-Date -format HH:mm:ss#calculate time difference$TimeDiff = New-TimeSpan $startTime $endTimeif ($TimeDiff.Hours -lt 0) ...Read more

codeigniter - view function not work properly on code igniter

hi i try to make basic view edit and delete on codeigniterim using table on customers/index.php to show all the customers data from db and it works, but when i try to open view function to view spesific customer with $id as a parameter only 1st data that showed, the 2rd, 3rd and so on show 404.this ss of my problemhttps://imgur.com/m3TjHMnhttps://imgur.com/HKah8Mihttps://imgur.com/2ig3h1zhttps://imgur.com/oVVv2LUhere ss of my db structurehttps://imgur.com/0v0Mx4qcustomers/index.php <h2 align="center"><?= $title ?></br></h2&...Read more