Re: [frege-programming-language] FlatMap?

2016-10-08 Thread Dierk König
It is the classic
>>=
operator or use the "do" notation. 
For the special case of lists, a list comprehension might also be appropriate. 
Check out FregeGoodness again. 

Dierk

sent from:mobile 

> Am 08.10.2016 um 17:25 schrieb Russel Winder :
> 
> I think I am getting a bit stressed :-(
> 
> I am not finding a flatMap function in Frege or Haskell. Obviously I
> can do a
> 
>foldr (++) [] $ map …
> 
> for a list of lists, but then there is the general case.
> 
> -- 
> Russel.
> =
> Dr Russel Winder  t: +44 20 7585 2200   voip: sip:russel.win...@ekiga.net
> 41 Buckmaster Roadm: +44 7770 465 077   xmpp: rus...@winder.org.uk
> London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Frege Programming Language" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to frege-programming-language+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Frege Programming Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to frege-programming-language+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [frege-programming-language] FregIDE and running QuickCheck

2016-10-04 Thread Dierk König
Make a run config for a Java Application that starts tools.QuickCheck. Let the 
main args point to your tests. 

Cheers
Dierk

sent from:mobile 

> Am 04.10.2016 um 16:43 schrieb Russel Winder :
> 
> Hi,
> 
> Is there a paragraph somewhere about setting up a run configuration in
> FregIDE for executing QuickCheck tests. I found the one for running
> code (after being embarrassed in a previous email thread :-) but
> (unless I am just being blinded by worry) I can't see the data needed
> for a testing configuration.
> 
> -- 
> Russel.
> =
> Dr Russel Winder  t: +44 20 7585 2200   voip: sip:russel.win...@ekiga.net
> 41 Buckmaster Roadm: +44 7770 465 077   xmpp: rus...@winder.org.uk
> London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Frege Programming Language" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to frege-programming-language+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Frege Programming Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to frege-programming-language+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [frege-programming-language] NaN literal

2016-10-04 Thread Dierk König
https://dierk.gitbooks.io/fregegoodness/content/src/docs/asciidoc/what.html

> Am 04.10.2016 um 18:19 schrieb Russel Winder :
> 
> Is there a NaN literal anywhere defined in Frege.
> 
> I have been blundering about but can't seem to find one.
> 
> Alternatively infinity.
> 
> --
> Russel.
> =
> Dr Russel Winder  t: +44 20 7585 2200   voip: sip:russel.win...@ekiga.net
> 41 Buckmaster Roadm: +44 7770 465 077   xmpp: rus...@winder.org.uk
> London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder
> 
> --
> You received this message because you are subscribed to the Google Groups 
> "Frege Programming Language" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to frege-programming-language+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Frege Programming Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to frege-programming-language+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: [frege-programming-language] Gradle Frege plugin and frege-java-frege dependency

2017-09-02 Thread Dierk König
Hi Markus,

bi-directional dependencies are always a bit difficult with alternative JVM 
languages but there are two ways to address this:

a) shared interface
The trick is to extract a shared Java interface and compile this in an extra 
(gradle) project, say "shared".
Then you let your core project depend on "shared". You can even split up your 
core project into
"java" and "frege" and let either depend on "shared".
Granted, this is a bit of setup work, but it somewhat models the dependencies 
nicely
and Gradle supports multi-project builds really well.

b) inline Java
You can inline your Java code right inside your Frege module files and they 
will be compiled together
in the same fashion that the Java compiler resolves bidirectional dependencies 
between two Java files.

Please let me know if that works for you.

Cheers
Dierk


> Am 02.09.2017 um 13:09 schrieb 'gulp21' via Frege Programming Language 
> :
> 
> Hi,
> 
> I’m trying to port my Frege projects from using makefiles to gradle,
> using the Frege gradle plugin. It works well for pure Frege projects and
> mixed Java and Frege projects in which the Frege code depends on the
> Java code. But now I have a project where Frege code depends on Java
> code and this Java code depends on another Frege file (see [1] for a
> minimal example). I couldn’t figure out how to make this work with the
> Frege gradle plugin, which always wants to compile the Java code first
> (which of course fails because the classes from the Frege code are
> missing). Do you have any advice on how to get this working?
> 
> Regards
> Markus
> 
> [1] https://github.com/mabre/gradle_frege_test
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Frege Programming Language" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to frege-programming-language+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Frege Programming Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to frege-programming-language+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [frege-programming-language] Re: Cont monad defined in Frege

2017-11-22 Thread Dierk König
Cool! Bring it on!

Dierk

sent from:mobile 

> Am 23.11.2017 um 03:10 schrieb zhou6...@163.com:
> 
> The code is working on my 3.24.100 Frege Repl, and I am trying to reinvent 
> ContT monad transformer in Frege now, hope I can learn more about Haskell
> 
> 在 2017年11月23日星期四 UTC+8上午10:07:07,zhou...@163.com写道:
>> 
>> No big deal, only recording my progress striving to understand monad and 
>> monad transformer with this tutorial 
>> https://en.wikibooks.org/wiki/Haskell/Continuation_passing_style and this 
>> https://wiki.haskell.org/All_about_monads#The_Continuation_monad
>> 
>> 
>> data Cont r a = Cont { runCont :: ((a -> r) -> r)}
>> 
>> instance Monad (Cont r) where
>>   pure x = cont ($ x)
>>   s >>= f = cont $ \c -> runCont s $ \x -> runCont (f x) c
>> 
>> cont :: ((a -> r) -> r) -> Cont r a
>> cont f = Cont { runCont = f}
>> 
>> runCont :: Cont r a -> (a -> r) -> r
>> runCont c = Cont.runCont c
>> 
>> callCC f = cont $ \h -> runCont (f (\a -> cont $ \_ -> h a)) h
>> 
>> fun :: Int -> String
>> fun n = (`runCont` id) $ do
>>str <- callCC $ \exit1 -> do
>>  when (n < 10) (exit1 (show n))
>>  let ns = map digitToInt (unpacked (show (n `div` 2)))
>>  n' <- callCC $ \exit2 -> do
>>when ((length ns) < 3) (exit2 (length ns))
>>when ((length ns) < 5) (exit2 n)
>>when ((length ns) < 7) $ do
>>  let ns` = map intToDigit (reverse ns)
>>  exit1 $ packed $ (dropWhile (== '0') ns')
>>return $ sum ns
>>  return $ "(ns = " ++ (show ns) ++ ") " ++ (show n')
>>return $ "Answer: " ++ str
>> 
>> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Frege Programming Language" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to frege-programming-language+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Frege Programming Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to frege-programming-language+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [frege-programming-language] Continuation transformer defined in Frege

2017-11-27 Thread Dierk König
Hi,

could you post the code that did not compile but should?

Cheers
Dierk

sent from:mobile 

> Am 27.11.2017 um 03:02 schrieb zhou6...@163.com:
> 
> ContT monad transformer sucks , Maybe Frege's type class is not complete 
> compatible with Haskell. The problem is the continuation variable can't be 
> passed out of callCC block. So I decide to implement my continuation 
> mechanism in JNI using scheme's call/cc 
> 
> 在 2017年11月24日星期五 UTC+8下午5:59:22,Dierk Koenig写道:
>> 
>> There are no official rules beyond what is common practice in the 
>> open-source community. 
>> When a Pull Request is raised, one of the committers validates the quality 
>> and then merges into master. 
>> When merging, the committer and the "author" can differ. You would be the 
>> author and visible as such in the repository. 
>> This is to show that you are the cool dude that provided the content :-) 
>> 
>> 
>> > Am 24.11.2017 um 10:23 schrieb zhou...@163.com: 
>> > 
>> > I still prefer my Chinese name Yu Zhou, I come from a none English 
>> > speaking country. I still have great barrier understanding the culture of 
>> > Frege group, what's the implied by PR on me as well as giving me due 
>> > credit? 
>> > 在 2017年11月24日星期五 UTC+8下午5:08:12,Dierk Koenig写道: 
>> > Ok, that is perfectly fine. 
>> > Then I do the PR on your behalf. 
>> > I’d like to give you due credit, though. Is there a special name or 
>> > nickname that you would like to see in a respective commit? 
>> > 
>> > Dierk 
>> > 
>> > sent from:mobile 
>> > 
>> > Am 24.11.2017 um 09:44 schrieb zhou...@163.com: 
>> > 
>> >> I am just a junior of Haskell, I just copy Michael Chavinda‏'s android 
>> >> project and rewrite existing software. Due to non disclosure agreement, I 
>> >> can't have my own git account. I think google group is the right place I 
>> >> could contribute some code back to Frege. Because my supervisor can not 
>> >> trace my activity on google because of Chinese GFW 
>> >> 
>> >> 在 2017年11月24日星期五 UTC+8下午3:01:21,Dierk Koenig写道: 
>> >> Would be cool to add it to the stdlib. 
>> >> Care about a PR? Best add a sample as well. 
>> >> 
>> >> Cheers 
>> >> Dierk 
>> >> 
>> >> sent from:mobile 
>> >> 
>> >> Am 24.11.2017 um 02:33 schrieb zhou...@163.com: 
>> >> 
>> >>> ContT is more pragmatic than Cont,with this powerful abstraction, I 
>> >>> could effectively abstract away callbacks and listener in Android. My 
>> >>> next exploration is to port coroutineT to Frege 
>> >>> 
>> >>> module examples.MyCont where 
>> >>> 
>> >>> class MonadIO m where 
>> >>>   --- Lift a computation from the 'IO' monad. 
>> >>>   liftIO :: IO a -> m a 
>> >>> 
>> >>> class MonadTrans t where 
>> >>>   --- Lift a computation from the argument monad to the constructed 
>> >>> monad. 
>> >>>   lift :: Monad m => m a -> t m a 
>> >>> 
>> >>> instance MonadIO IO where 
>> >>>   liftIO io = io 
>> >>> 
>> >>> instance MonadTrans (ContT r) where 
>> >>> lift m = ContT (m >>=) 
>> >>> 
>> >>> instance (Monad m, MonadIO m) => MonadIO (ContT r m) where 
>> >>> liftIO = lift . liftIO 
>> >>> 
>> >>> data ContT r m a = ContT { runContT :: (a -> m r) -> m r } 
>> >>> 
>> >>> instance Monad (ContT r m) where 
>> >>>   pure x = contT ($ x) 
>> >>>   m >>= k = contT $ \c -> runContT m (\x -> runContT (k x) c) 
>> >>> 
>> >>> contT :: ((a -> m r) -> m r) -> ContT r m a 
>> >>> contT f = ContT { runContT = f } 
>> >>> 
>> >>> runContT :: ContT r m a -> ((a -> m r) -> m r) 
>> >>> runContT c = ContT.runContT c 
>> >>> 
>> >>> callCC :: ((a -> ContT r m b) -> ContT r m a) -> ContT r m a 
>> >>> callCC f = ContT $ \c -> ContT.runContT (f (\a -> ContT $ \_ -> c a)) c 
>> >>> 
>> >>> data Data = native java.util.Date where 
>> >>>   native new :: () -> IO (MutableIO Data) 
>> >>>   native toString :: Mutable s Data -> ST s String 
>> >>> 
>> >>> current :: IO String 
>> >>> current = do 
>> >>>   d <- Data.new () 
>> >>>   d.toString 
>> >>> 
>> >>> fun :: Int -> IO String 
>> >>> fun = (`runContT` id) $ do 
>> >>>   callCC $ \exit1 -> do 
>> >>> exit1 $ liftIO current 
>> >>> 
>> >>> 
>> >>> 
>> >>> 
>> >>> 
>> >>> 
>> >>> -- 
>> >>> You received this message because you are subscribed to the Google 
>> >>> Groups "Frege Programming Language" group. 
>> >>> To unsubscribe from this group and stop receiving emails from it, send 
>> >>> an email to frege-programming-language+unsubscr...@googlegroups.com. 
>> >>> For more options, visit https://groups.google.com/d/optout. 
>> >> 
>> >> -- 
>> >> You received this message because you are subscribed to the Google Groups 
>> >> "Frege Programming Language" group. 
>> >> To unsubscribe from this group and stop receiving emails from it, send an 
>> >> email to frege-programming-language+unsubscr...@googlegroups.com. 
>> >> For more options, visit https://groups.google.com/d/optout. 
>> > 
>> > -- 
>> > You received this message because you are subscribed to the Google Groups 
>> > "Frege Programming Language" group. 
>> > To unsubscribe from